package com.group9.handinhand.dao.model;

import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToOne;

import com.group9.handinhand.service.so.ActivityEnums.ActivityType;

@MappedSuperclass
public abstract class Activity extends AbstractBaseModel {

	private static final long serialVersionUID = 1L;
	
	@ManyToOne
	@JoinColumn(name = "COMMUNITY_ID", nullable = false)
	private Community community;
	
	@Column(name = "ACTIVITY_NAME", nullable = false)
	private String name;
	
	@Column(name = "DESCRIPTION")
	private String description;
	
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "CREATOR_ID", nullable = false)
	private User creator;
	
	@Enumerated(EnumType.STRING)
	@Column(name = "ACTIVITY_TYPE", nullable = false)
	private ActivityType activityType;
	
	@OneToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "SERVICE_ID")
	private Services service;
	
	@OneToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "GOODS_ID")
	private Goods goods;
	
	public Community getCommunity() {
		return community;
	}

	public void setCommunity(Community community) {
		this.community = community;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public User getCreator() {
		return creator;
	}

	public void setCreator(User creator) {
		this.creator = creator;
	}

	public ActivityType getActivityType() {
		return activityType;
	}

	public void setActivityType(ActivityType activityType) {
		this.activityType = activityType;
	}

	public Services getService() {
		return service;
	}

	public void setService(Services service) {
		this.service = service;
	}

	public Goods getGoods() {
		return goods;
	}

	public void setGoods(Goods goods) {
		this.goods = goods;
	}

	@Override
	public String toString() {
		return "Activity [community=" + community + ", name=" + name
				+ ", description=" + description + ", creator=" + creator
				+ ", activityType=" + activityType + ", service=" + service
				+ ", goods=" + goods + "]";
	}
	
	

}
